<script setup>
import { PlusOutlined, SearchOutlined, RedoOutlined } from '@ant-design/icons-vue'
import { ref } from 'vue'
const emits = defineEmits(['add', 'init', 'search'])

const schVal = ref('')
// 新增按钮点击
const add = () => {
  emits('add')
}
// 刷新
const init = () => {
  schVal.value = ''
  emits('init')
}
// 搜索
const search = () => {
  emits('search', { name: schVal.value })
}
</script>

<template>
  <div class="head">
    <AButton type="primary" @click="add"> <PlusOutlined /> 新增 </AButton>
    <div class="right">
      <a-input
        @input="search"
        v-model:value="schVal"
        placeholder="请输入查询"
        class="com-ipt"
        allowClear
      >
        <template #suffix>
          <SearchOutlined />
        </template>
      </a-input>
      <AButton type="primary" @click="search"> <SearchOutlined /> 搜索 </AButton>
      <AButton type="primary" @click="init"> <RedoOutlined /> 刷新 </AButton>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.head {
  display: flex;
  gap: 8px;
  justify-content: space-between;

  .right {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
  }
}
</style>